import Vue from "vue";
import VueRouter from "vue-router";
import Error404 from "../views/error/Error404";
import NewSongs from "@/views/NewSongs";
import rank from "@/views/rank";
import Plist from "@/views/Plist";
import singer from "@/views/Singers";
import Search from "@/views/Search";
import RankInfo from "@/views/RankInfo";
import PlistInfo from "@/views/PlistInfo";
import SingerList from "@/views/SingerList";
import SingerInfo from "@/views/SingerInfo";
import TestView from "@/views/TestView";
import Index from "@/views/Index";
Vue.use(VueRouter);

const router = new VueRouter({
  routes: [
    {
      path: "*",
      name: "404",
      meta: { title: "404页面" },
      component: Error404
    },
    {
      path: "/newSongs",
      component: Index,
      alias: "/",
      children: [
        {
          path: "/rank",
          component: rank
        },    {
          path: "/",
          component: NewSongs
        },
        {
          path: "/plist",
          component: Plist
        },
        {
          path: "/singer",
          component: singer
        },
        {
          path: "/search",
          component: Search
        },
        {
          path: "/rank/info/:id",
          component: RankInfo
        },
        {
          path: "/plist/info/:id",
          component: PlistInfo
        },
        {
          path: "/singer_list/:id",
          component: SingerList
        },
        {
          path: "/singer_info/:id",
          component: SingerInfo
        }
      ]
    },
    {
      path: "/test",
      component: TestView
    },

    {
      path: "*",
      redirect: "/"
    }
  ]
});

export default router;
